<?php
function litimgurls($imgid=0)
{
    global $lit_imglist,$dsql;
    //获取附加表
    $row = $dsql->GetOne("SELECT c.addtable FROM #@__archives AS a LEFT JOIN #@__channeltype AS c 
                                                            ON a.channel=c.id where a.id='$imgid'");
    $addtable = trim($row['addtable']);
    
    //获取图片附加表imgurls字段内容进行处理
    $row = $dsql->GetOne("Select imgurls From `$addtable` where aid='$imgid'");
    
    //调用inc_channel_unit.php中ChannelUnit类
    $ChannelUnit = new ChannelUnit(2,$imgid);
    
    //调用ChannelUnit类中GetlitImgLinks方法处理缩略图
    $lit_imglist = $ChannelUnit->GetlitImgLinks($row['imgurls']);
    
    //返回结果
    return $lit_imglist;
}

//取得顶级栏目
function GetTopTypename($id) {
    global $dsql;
    $row = $dsql->GetOne("SELECT typename,topid FROM cms_arctype WHERE id= $id");
    if ($row['topid'] == '0')
    {
        return $row['typename'];
    }
    else
    {
        $row1 = $dsql->GetOne("SELECT typename FROM cms_arctype WHERE id= $row[topid]");
        return $row1['typename'];
    }
}

function GetTopTypeurl($id) {
    global $dsql;
    $row = $dsql->GetOne("SELECT typedir,topid FROM cms_arctype WHERE id= $id");
    if ($row['topid'] == '0')
    {
    	$topurl = str_replace("{cmspath}",'',$row['typedir']);
        return $topurl;
    }
    else
    {
        $row1 = $dsql->GetOne("SELECT typedir FROM cms_arctype WHERE id= $row[topid]");
        $topurl1 = str_replace("{cmspath}",'', $row1['typedir']);
        return $topurl1;
    }
}
